home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_04
/
8n04084a
< prev
next >
Wrap
Text File
|
1990-03-18
|
1KB
|
42 lines
*****Listing 1*****
semaphor.h
#ifndef SEMAPHOR_H /* prevent multiple includes */
#define SEMAPHOR_H
#include <limits.h>
#ifndef PATH_MAX
#define PATH_MAX (256) /* max # of characters in a path name */
#endif
/* constants */
#define SEMOPEN_MAX (60) /* max # semaphore sets open at once */
/* type definitions */
typedef struct { /* semaphore set control structure */
char semdir[PATH_MAX + 1]; /* semaphore directory path name */
int semc; /* semaphore count */
} semset_t;
/* function declarations */
int semclose(semset_t *ssp);
#define semcount(ssp) ((ssp)->semc)
int semlower(semset_t *ssp, int semno);
semset_t * semopen(char *semdir, int flags, int semc);
int semraise(semset_t *ssp, int semno);
int semremove(char *semdir);
/* semopen command flags */
#define SEM_CREAT (01000) /* create and open */
#define SEM_EXCL (02000) /* exclusive open */
/* error codes */
#define SEMEOS (0) /* start of error code domain */
#define SEMEMFILE (SEMEOS - 1) /* too many semaphore sets open */
#define SEMPANIC (SEMEOS - 2) /* internal semaphore error */
#endif /* #ifndef SEMAPHOR_H */